import request from '@/plugins/request';
//系统用户
export function GetUserList (data: Record<string, any>) {
    return request({
        url: '/api/admin/account/page',
        method: 'get',
        params:data
    });
}

//新增系统用户
export function CreateUser (data: Record<string, any>) {
    return request({
        url: '/api/admin/account/save',
        method: 'post',
        data
    });
}

//获取用户已关联的角色

export function getAuthRoleList(data: Record<string, any>) {
  return request({
    url: "/api/admin/account/getAuthRoleList",
    method: "get",
    params: data,
  });
}


;
//主体信息
export function GetSubjectList (data: Record<string, any>) {
    return request({
      url: "/api/admin/firm/page",
      method: "get",
      params: data,
    });
}

//主体详情
export function getFirmInfo(data: Record<string, any>) {
  return request({
    url: "/api/admin/firm/queryFirmInfo",
    method: "get",
    params: data,
  });
}

//新增主体信息
export function SaveFirmAndProduct (data: Record<string, any>) {
  return request({
    url: '/api/admin/firm/saveFirmAndProduct',
    method: 'post',
    data
   });
}

//编辑主体信息
export function UpdateFirmAndProduct (data: Record<string, any>) {
  return request({
    url: '/api/admin/firm/updateFirmAndProduct',
    method: 'put',
    data
   });
}

//删除主体
export function delMultipleFirm(data: Record<string, any>) {
  return request({
    url: "/api/admin/firm?firmId=" + data.firmId,
    method: "delete",
  });
}

//批量删除主体
export function DelBatch(data: Record<string, any>) {
  return request({
    url: "/api/admin/firm/delBatch?firmIds=" + data.firmIds,
    method: "delete",
  });
}

//批量禁用主体
export function DeleteDisableBatchFirm(data: Record<string, any>) {
  return request({
    url: "/api/admin/firm/disableBatch?firmIds=" + data.firmIds,
    method: "get",
  });
}

//批量启用主体
export function getEnableBatchFirm(data: Record<string, any>) {
  return request({
    url: "/api/admin/firm/enableBatch?firmIds=" + data.firmIds,
    method: "get",
  });
}


//分配主体用户
export function bindfirmUsers(data: Record<string, any>) {
  return request({
    url: "/api/admin/firmUser/bind",
    method: "put",
    data,
  });
}
//查询主体绑定的用户
;
export function getFirmUsers(data: Record<string, any>) {
  return request({
    url: "/api/admin/firmUser/getFirmUsers",
    method: "get",
    params:data
  });
}
//应用授权
export function bindfirmApps(data: Record<string, any>) {
  return request({
    url: "/api/admin/firmApp/bind",
    method: "put",
    data,
  });
}
//查询主体绑定的应用 
export function firmAppList(data: Record<string, any>) {
  return request({
    url: "/api/admin/firmApp/getFirmAppList?firmId=" + data.firmId,
    method: "get",
  });
}
//新增主体产品 
export function postFirmProduct(data: Record<string, any>) {
  return request({
    url: "/api/admin/firmProduct",
    method: "post",
    data,
  });
}

//编辑主体产品 
export function putFirmProduct(data: Record<string, any>) {
  return request({
    url: "/api/admin/firmProduct",
    method: "put",
    data,
  });
}
//删除主体产品  
export function deleteFirmProduct(data: Record<string, any>) {
  return request({
    url: "/api/admin/firmProduct?productId=" + data.productId,
    method: "delete",
  });
}

//主体产品详情  
export function getFirmProductDetail(data: Record<string, any>) {
  return request({
    url: "/api/admin/firmProduct/detail?productId=" + data.productId,
    method: "get",
    data,
  });
}

//校验主体产品编码是否已使用   
export function getFirmProductCheckCode(data: Record<string, any>) {
  return request({
    url: "/api/admin/firmProduct/checkCode",
    method: "get",
    params: data,
  });
}


//批量删除用户
export function DeleteMultipleUser (data: Record<string, any>) {
    return request({
        url: '/api/admin/account/delBatch?userIds='+data.userIds,
        method: 'delete'
    });
}


//删除用户
export function DeleteUser (data: Record<string, any>) {
    return request({
        url: '/api/admin/account?userId='+data.userId,
        method: 'delete'
    });
}

//编辑用户
export function UpdateUser (data: Record<string, any>) {
    return request({
        url: '/api/admin/account/update',
        method: 'post',
        data
    });
}

//查询应用及应用下的角色二级列表（不分页）
export function GetRoleList (data: Record<string, any>) {
    return request({
        url: '/api/admin/role/getAppRoleList',
        method: 'get',
        params:data
    });
}

//用户分配角色
export function putAuthRole (data: Record<string, any>) {
    return request({
        url: '/api/admin/account/authRole',
        method: 'put',
        data
    });
}


//批量禁用用户
export function DeleteDisableBatch (data: Record<string, any>) {
    return request({
        url: '/api/admin/account/disableBatch?userIds='+data.userIds,
        method: 'get'
    });
}

//批量启用用户
export function getEnableBatch (data: Record<string, any>) {
    return request({
        url: '/api/admin/account/enableBatch?userIds='+data.userIds,
        method: 'get'
    });
}
//产品类别列表-树形 
export function getProCategoryTree (data: Record<string, any>){
  return request({
    url: "/api/admin/companyCategory/productCategoryTree",
    method: "get",
    params: data,
  });
}

//租户列表（分页查询）
export function GetTenantPage(data: Record<string, any>) {
  return request({
    url: "/api/admin/tenant/page",
    method: "get",
    params: data,
  });
}

//系统日志（分页查询）
export function GetLogPage(data: Record<string, any>) {
  return request({
    url: "/api/audit/log/page",
    method: "get",
    params: data,
  });
}

//系统日志（删除日志）
export function DelLogPage(data: Record<string, any>) {
  return request({
    url: "/api/audit/log/del/" + data.id,
    method: "delete",
  });
}
//日志详情
export function GetLogDetail(data: Record<string, any>) {
  return request({
    url: "/api/audit/log/" + data.id,
    method: "get",
  });
}

//身份源列表
export function GetSisPage(data: Record<string, any>) {
  return request({
    url: "/api/admin/sis/page",
    method: "get",
    params: data,
  });
}

//查询身份源类型列表
export function GetTypeList(data: Record<string, any>) {
  return request({
    url: "/api/admin/sis/getTypeList",
    method: "get",
    params: data,
  });
}

//新增身份源 
export function PostAddSis(data: Record<string, any>) {
  return request({
    url: "/api/admin/sis/save",
    method: "post",
    data,
  });
}

//修改身份源 
export function putAdminSis (data: Record<string, any>) {
    return request({
      url: "/api/admin/sis/edit",
      method: "put",
      data,
    });
}

//删除身份源
export function deleteSis(data: Record<string, any>) {
  return request({
    url: "/api/admin/sis",
    method: "delete",
    params: data,
  });
}

//启用身份源
export function GetSisEnable(data: Record<string, any>) {
  return request({
    url: "/api/admin/sis/enable",
    method: "get",
    params: data,
  });
}

//禁用身份源
export function GetSisDisable(data: Record<string, any>) {
  return request({
    url: "/api/admin/sis/disable",
    method: "get",
    params: data,
  });
}
//绑定身份源 
export function bindSis(data: Record<string, any>) {
  return request({
    url: "/api/admin/app/bindSis",
    method: "put",
    data,
  });
}
//解除绑定身份源 
export function unbindSis(data: Record<string, any>) {
  return request({
    url: "/api/admin/app/unbindSis",
    method: "put",
    data,
  });
}


//主体商品列表
export function getFirmProductList(data: Record<string, any>) {
  return request({
    url: "/api/admin/firmProduct/list",
    method: "get",
    params: data,
  });
}

//分页查询路由
export function getRoutePage(data: Record<string, any>) {
  return request({
    url: "/api/admin/route/page",
    method: "get",
    params: data,
  });
}

//路由详情 
export function getRouteDetail(data: Record<string, any>) {
  return request({
    url: "/api/admin/route/" + data.id,
    method: "get",
  });
}

//删除路由
export function deleteRoute(data: Record<string, any>) {
  return request({
    url: "/api/admin/route/" + data.id,
    method: "delete",
  });
}

//修改-新增路由 
export function CreateRoute(data) {
  return request({
    url: "/api/admin/route/single",
    method: "post",
    data,
  });
}











